package com.example.blog.modules.article.repository;

import com.example.blog.modules.article.entity.Article;
import com.example.blog.modules.article.entity.Favorite;
import com.example.blog.modules.user.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface FavoriteRepository extends JpaRepository<Favorite, Long> {
    boolean existsByUserAndArticle(User user, Article article);
    void deleteByUserAndArticle(User user, Article article);
    Page<Favorite> findByUser(User user, Pageable pageable);
    long countByUser(User user);
    long countByArticle(Article article);
} 